<template>
	<view class="box">
		<view class="header">
			<image src="../../../static/img/monitor/referral/title1.png"></image>
			<view class="information">
				<view class="top">
					<view>会员：{{details.userName}}</view> 
					<view>年龄：{{details.age}}</view> 
					<view>性别：{{details.sex}}</view> 
				</view>
				<view class="bottom">
					<view>签发人：{{details.healthName}}</view>
					<view>签发日期：{{details.modifiedDate && details.modifiedDate.substr(0,10)}}</view> 
				</view>
			</view>
		</view>
		<view class="two"></view>
		<view class="three"></view>
		
		<view class="mainContent">
			<!-- 双向转诊单存根 -->
			<view class="boxOne">
				<view class="title">双向转诊单存根</view>
				<view class="firstCase">
					<view class="name">
						<view class="xinxi"><span>患者姓名</span> <view>{{details.userName}}</view></view>
						<view><span>性别</span> <view>{{details.sex}}</view></view>
						<view><span>年龄</span> <view>{{details.age}}</view></view>
					</view>
					
					<view class="name">
						<view><span>档案编号</span> <view>{{details.userSn}}</view></view>					
					</view>
					
					<view class="name">
						<view><span>家庭住址</span> <view>{{details.add}}</view></view>
					</view>
					
					<view class="name">
						<view class="xinxi"><span>联系电话</span> <view>{{details.phone}}</view></view>
					</view>
					
					<view class="name">					
						<view class="flex"><span>于</span> <view>{{details.transferDate && details.transferDate.substr(0,4)}}</view></view>
						<view class="flex"><span>年</span> <view>{{details.transferDate && details.transferDate.substr(5,2)}}</view></view>
						<view class="flex"><span>月</span> <view>{{details.transferDate && details.transferDate.substr(8,2)}}</view></view>
						<view class="placeholder"><span>日因病需要，</span></view>
					</view>
					
					<view class="name">
						<view class="xinxi"><span>转入</span> <view>{{details.referralInstitution}}</view></view>
						<view class="xinxi"><span>单位</span> <view>{{details.department}}</view></view>
					</view>
					
					<view class="name">
						<view class="xinxi"><span>科室</span> <view>{{details.attendingDoctor}}</view></view>
						<view class="xinxi"><span>接诊医生。</span></view>
					</view>
					
					<view class="sign">
						<view>转诊医生(签字):{{details.referralDoctor}}</view>
						<view class="year">{{details.referralDate && details.referralDate.substr(0,4)}}年{{details.referralDate && details.referralDate.substr(5,2)}}月{{details.referralDate && details.referralDate.substr(8,2)}}日</view>
					</view>
				</view>
			</view>
			
			<!-- 双向转诊（转出）单 -->
			<view class="boxOne">
				<view class="title">双向转诊(转出)单</view>
				<view class="secondCase">
					<view class="name">
						<view class="xinxi"><view>{{details.organizationName}}</view><span>(机构名称)</span> </view>
					</view>
					<view class="name">
						<view class="xinxi"><span>现有患者</span> <view>{{details.userName}}</view></view>
						<view><span>性别</span> <view>{{details.sex}}</view></view>
						<view><span>年龄</span> <view>{{details.age}}</view></view>
					</view>
					<view class="name">
						<view class="xinxi"><span>因病情需要，需转入贵单位，请予以接诊。</span></view>
					</view>
					
					<view class="initial">
						<view>初步印象：</view>
						<view class="initialContent"><rich-text :nodes="details.initialImpression"></rich-text></view>
					</view>
					
					<view class="initial">
						<view>主要现病史(转出原因)：</view>
						<view class="initialContent"><rich-text :nodes="details.medicalHistory"></rich-text></view>
					</view>
					
					<view class="initial">
						<view>主要既往史：</view>
						<view class="initialContent"><rich-text :nodes="details.majorPastHistory"></rich-text></view>
					</view>
					
					<view class="initial">
						<view>治疗经过：</view>
						<view class="initialContent"><rich-text :nodes="details.courseOfTreatment"></rich-text></view>
					</view>
					
					<view class="secondSign">
						<view class="referral">
							<view>转诊医生(签字)：</view>
							<view>{{details.referralDoctor}}</view>
						</view>
						<view class="referral">
							<view>联系电话：</view>
							<view>{{details.doctorPhone}}</view>
						</view>
						<view class="referralSecond">
							<view>{{details.referralInstitution}}</view>
							<view>(机构名称)</view>
						</view>
						<view class="date">
							<view class="year">{{details.referralDate && details.referralDate.substr(0,4)}}年{{details.referralDate && details.referralDate.substr(5,2)}}月{{details.referralDate && details.referralDate.substr(8,2)}}日</view>
						</view>
					</view>
					
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {getUrlParam} from '@/static/js/filter.js'
	export default{
		data () {
			return {
				details: {},
			}
		},
		onLoad() {
			this.id = getUrlParam('id');
			if(this.id) {
				const _this = this;
				_this.$api.AppHealthReferralRecordsInfo(_this.id).then((res) => {
					if(res.data.returnCode == 200) {	
						this.details = res.data.result
						this.$api.getUserInfo().then((res) => {
							this.details.sex = res.data.result && res.data.result.sex == 2?'女':'男';
							this.details.age = res.data.result && res.data.result.age
						})
					}
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	@import '@/static/css/monitor/referral/toView.scss';
</style>
